home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0027_SETMODE3.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  74 lines

  1. {PK>SetVisualPage are Procedures I spent a lot of time investigating with
  2. PK>Really weird results. In fact I locked up Computer several times and
  3.  
  4. I hate it when that happens <g>.
  5.  
  6. PK>then I got frustrated and posted the message hoping there would be some
  7. PK>other way how to go about it. tom Swan's book Mastering Turbo Pascal 6.0
  8.  
  9. There is: Don't use Graph.TPU and Write all your own routines.  In the
  10. following Program, 3 routines SetVidMode, SetPage, and PutPix
  11. illustrate a Graph.TPU-less example of your original requirement.
  12. }
  13.  
  14. Program test0124;
  15. Uses Dos;
  16.  
  17. Const
  18.   VidMode = $10;  {..640x350x16 - Supported By VGA and Most EGA }
  19. Var
  20.   x,y : Integer;
  21.   reg : Registers;
  22.  
  23. Procedure SetVidMode(VidMode :Integer);
  24.   begin
  25.   reg.ah := $00;
  26.   reg.al := VidMode;
  27.   intr($10,reg);
  28.   end;
  29.  
  30. Procedure SetPage(Page :Integer);
  31.   begin
  32.   reg.ah := $05;
  33.   reg.al := page;
  34.   intr($10,reg);
  35.   end;
  36.  
  37. Procedure PutPix(Color,Page,x,y : Integer);
  38.   begin
  39.   reg.ah := $0C;
  40.   reg.al := Color;
  41.   reg.bh := Page;
  42.   reg.cx := x;
  43.   reg.dx := y;
  44.   intr($10,reg);
  45.   end;
  46.  
  47. begin
  48. SetVidMode(VidMode);
  49. SetPage(0);                                {..set active display page }
  50. For x := 200 to 440 do                     {..use custom PutPix to }
  51.   For y := 100 to 250 do PutPix(3,1,x,y);  {  draw to different page }
  52. Write(^g);
  53. ReadLn;                                    {..press enter to switch }
  54. SetPage(1);                                {  active display page }
  55. ReadLn;
  56. end.
  57.  
  58. {
  59. There are only a few dozen more routines that you need to have the
  60. Functionality of Graph.TPU - simple stuff like manipulating palettes,
  61. line/circle/polygon algorithms, fill routines, etc., etc....have fun.
  62.  
  63. PK>list all video modes and number of pages it is capable of working with
  64. PK>and VGA in 640x480 (that's the mode I have) is supposed to handle only
  65. PK>one page. That's is probably the reason why it doesn't work. What is
  66.  
  67. That would do it.  From my reference, Advanced MS Dos Programming - Ray
  68. Duncan, The best resolution you can get With multiple page support is
  69. 640x350 (Mode $10).
  70.  
  71. About the ClearViewPort conflict, I experienced similar problems - I
  72. went as Far as pixelling out portions of the display to avoid using
  73. ClearViewPort <Sheesh!> - that Graph Unit doesn't make anything easy.
  74. }